package com.wh.springbootrabbitmq.config;


import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;

/**
 * @Auther: HuiEr
 * @Date: 2020/3/15 17:43
 * @Description
 */
@SpringBootConfiguration
public class RabbitConfig {
    @Bean
    public Queue routerQueue1(){
        return new Queue("router_q1");
    }

    @Bean
    public Queue routerQueue2(){
        return new Queue("router_q2");
    }
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("router_ex");
    }

    @Bean
    public Binding bindingRouter1(){
        return BindingBuilder.bind(routerQueue1()).to(directExchange()).with("xiao");
    }
    @Bean
    public Binding bindingRouter2(){
        return BindingBuilder.bind(routerQueue2()).to(directExchange()).with("da");
    }
}
